package com.zlt.bkparking.controller.salesman;

import com.zlt.bkparking.dto.AdvertisersUserDTO;
import com.zlt.bkparking.service.AdvertisementService;
import com.zlt.bkparking.vo.AdvertisersUserVO;
import com.zlt.bkparking.vo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("advertisersUser")
public class AdvertisersUserController {

    @Autowired
    private AdvertisementService advertisementService;

    /**
     * 添加新广告商客户
     * @param advertisersUserDTO
     * @return
     */
    @PostMapping("addAdvertisersUser")
    public Result addAdvertisersUser(AdvertisersUserDTO advertisersUserDTO) {
        AdvertisersUserVO advertisersUserVO = advertisementService.addAdvertisersUser(advertisersUserDTO);
        return Result.ok("添加新广告商客户成功", advertisersUserVO);
    }

    /**
     * 显示广告商列表
     * @return
     */
    @GetMapping("showAdvertisersUser")
    public Result showAdvertisersUser() {
        List<AdvertisersUserVO> advertisersUserVOS = advertisementService.showAdvertisersUser();
        return Result.ok("查询广告商列表成功", advertisersUserVOS);
    }

//    /**
//     * 通过auId去查询客户名
//     * @param auId
//     * @return
//     */
//    @GetMapping("queryAdvertiserByAuId/{auId}")
//    public Result queryAdvertiserByAuId(@PathVariable("auId") String auId) {
//        System.out.println(auId);
//        AdvertisersUserVO advertisersUserVO = advertisementService.queryAdvertiserByAuId(Long.parseLong(auId));
//        return Result.ok("查询客户名成功", advertisersUserVO);
//    }
}
